<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>访客管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/3rd/X-admin/css/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/3rd/X-admin/css/xadmin.css">
    <script src="${pageContext.request.contextPath}/3rd/X-admin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/3rd/X-admin/js/xadmin.js"></script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5">
                        访客姓名：
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="visitorName" id="visitorName" >
                        </div>
                        &nbsp;&nbsp;
                        被访人姓名：
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="userName" id="userName" >
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-header">
                    <button class="layui-btn" onclick="xadmin.open('添加影像信息','/videoFlowingManager/videoFlowing-add',430,470)"><i class="layui-icon"></i>添加影像信息</button>
                </div>
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>访客姓名</th>
                            <th>被访人姓名</th>
                            <th>到访时间</th>
                            <th>访客影像</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                        <c:forEach items="${page.list}" var="list">
                            <tr>
                                <td>${list.visitorName}</td>
                                <td>${list.userName}</td>
                                <td>${list.visitorTime}</td>
                                <td><img src="${list.visitorPic}" style="width: 60px;"></td>
                                <td class="td-manage">
                                    <a title="修改"  onclick="update(this,${list.id})" href="javascript:;">
                                        <i class="layui-icon">&#xe642;</i>
                                    </a>
                                    <a title="删除" onclick="del(this,${list.id})" href="javascript:;">
                                        <i class="layui-icon">&#xe640;</i>
                                    </a>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        <div>
                            <a class="layui-laypage-next ${page.isFirstPage ?'layui-disabled':''}" href="${pageContext.request.contextPath}/videoFlowingManager/videoFlowingList?pageNum=${page.isFirstPage?page.pageNum:page.prePage}">上一页</a>
                            <a class="num" href="">${page.pageNum}/${page.pages}</a>
                            <a class="next ${page.isLastPage?'layui-disabled':''}" href="${pageContext.request.contextPath}/videoFlowingManager/videoFlowingList?pageNum=${page.isLastPage?page.pageNum:page.nextPage}" >下一页</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
    });
    function update(obj,id) {
        layer.alert("修改成功", {icon: 6 });
    }

    function update(obj,id) {
        xadmin.open('访客影像信息','${pageContext.request.contextPath}/videoFlowingManager/videoFlowing-edit?id='+id,430,470);
    }

    /*用户-删除*/
    function del(obj, id){
        layer.confirm('确认要删除吗？',function(index){
            //发异步删除数据
            $.post("${pageContext.request.contextPath}/videoFlowingManager/delVideoFlowing/"+id,function (data) {
                var result = eval(data);
                if (result.status==200){
                    $(obj).parents("tr").remove();
                    layer.alert("删除成功", {icon: 6 });
                } else {
                    layer.alert("删除失败", {
                            icon: 6
                        },
                        function() {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                }
            })
            layer.alert("删除成功", {icon: 6 });
        });
    }
</script>
</html>